﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SkypeBot.Commands
{
    using SkypeBot.Core;

    class SmileCommand : IMessageHandler
    {
        [Message(@"^!ss#(?<smile>\d{1,2})(?<count>x\d{1,3})?(?<divider>'.*')?$")]
        public Responce SendSmiles(Message objMessage,string smile, string count, string divider)
        {
            int intCount = count == "" ? 1 : int.Parse(count.Remove(0,1));
            int intSmile = int.Parse(smile);
            string strDivider = string.Empty;
            string strResult = string.Empty;
            if (intCount > 89 || intCount < 0)
            {
                intCount = -1;
            }
            if (divider != "")
            {
                strDivider = divider[1].ToString();
            }
            for (int i = 0; i < intCount;i++ )
            {
                strResult += string.Format("{0}{1}", Smile.GetSmile((Smiles)intSmile), strDivider);
            }
            return new Responce(strResult + "\r\n");
        }

      
    }
}
